package com.daiyang.seckill.controller;

import com.daiyang.seckill.service.UserService;
import com.daiyang.seckill.vo.LoginVo;
import com.daiyang.seckill.vo.RespBean;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Slf4j
@Controller
@RequestMapping("/login")
public class LoginController {
    @Resource(name ="userServiceImpl")
    private UserService userService;

    @RequestMapping("/doLogin")
    @ResponseBody
    public RespBean doLogin(@Valid LoginVo loginVo, HttpServletRequest request, HttpServletResponse response) {
           log.info("loginVo:{}",loginVo);
           return  userService.doLogin(loginVo, request, response);
    }

}
